package com.wa.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 日志模块枚举
 * @Author Dawn
 * @Date 2021/10/19 10:02
 */
public enum LogModuleEnum {
    ACCOUNT(10, "Account Management", "账号管理", LogPlatformEnum.USER.getStatusCode()),
    DEPT(20, "Department Management", "组织架构管理", LogPlatformEnum.USER.getStatusCode()),
    USER(30, "User Management", "人员管理", LogPlatformEnum.USER.getStatusCode()),
    ROLE(40, "Role Management", "角色管理", LogPlatformEnum.USER.getStatusCode()),
    DATA_PERMISSION(50, "Data permission Management", "数据权限管理", LogPlatformEnum.USER.getStatusCode()),
    GOODS(60, "Goods Management", "商品管理", LogPlatformEnum.GOODS.getStatusCode()),
    SMS(70, "sms", "短信", LogPlatformEnum.NONE.getStatusCode()),
    EMAIL(80, "email", "邮件", LogPlatformEnum.NONE.getStatusCode()),
    ;

    private int statusCode;
    private String statusMsgEn;
    private String statusMsgCn;
    /**
     * 所属平台（0表示为不限平台的公共日志）
     * {@link LogPlatformEnum}
     */
    private int platformCode;
    private static final Map<Integer, LogModuleEnum> lookup = new HashMap<Integer, LogModuleEnum>();

    static {
        for (LogModuleEnum ase : LogModuleEnum.values()) {
            lookup.put(ase.getStatusCode(), ase);
        }
    }
    LogModuleEnum(int statusCode, String statusMsgEn, String statusMsgCn, int platformCode) {
        this.statusCode = statusCode;
        this.statusMsgEn = statusMsgEn;
        this.statusMsgCn = statusMsgCn;
        this.platformCode = platformCode;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public String getStatusMsgEn() {
        return statusMsgEn;
    }

    public String getStatusMsgCn() {
        return statusMsgCn;
    }

    public int getPlatformCode() {
        return platformCode;
    }


    public static LogModuleEnum get(Integer statusCode) {
        return lookup.get(statusCode);
    }

}
